import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:totaldemo/getx/controller.dart';

class StateWorkersView extends StatelessWidget {
  StateWorkersView({Key key}) : super(key: key);
  final c = DebounController();
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('防抖限流--getx的workers'),
      ),
      body: Center(
        child: Column(
          children: [
            GetX<DebounController>(
              init: c,
              initState: (_) {},
              builder: (_) {
                return Text('value ->  + ${_.count}');
              },
            ),
            ElevatedButton(
                onPressed: () {
                  c.add();
                },
                child: Text('add'))
          ],
        ),
      ),
    );
  }
}
